#include <stdio.h>
#include <stdlib.h>

int hex_to_bin(char a)
{
	if(a >= '0' && a <= '9') {
		return a - '0';
	}else if(a >= 'a' && a <= 'f') {
		return a - 'a' + 10;
	}
	return -1;
}
int main()
{
	char  a = 'a';
	printf("%c \n", (a + 1));


	char ch = '9'; // 示例字符
    int value;

    // 方法1: 减去 '0'
    value = ch - '0';
    printf("字符 '%c' 转换为整数值: %d\n", ch, value);

    // 方法2: 减去 48 (因为 '0' 的ASCII值是48)
    value = ch - 48;
    printf("字符 '%c' 转换为整数值: %d\n", ch, value);

    printf("==%d \n", hex_to_bin('9'));
	printf("==%d \n", hex_to_bin('f'));

	return EXIT_SUCCESS;
}
